<template>
  <div>
    这里是index 页面,此时登录的用户是{{userName}}
    <el-button type="warning" @click="logout">退出</el-button>
  </div>
</template>

<script>
export default {
  name: "index",
  data() {
    return {};
  },
  methods: {
    logout() {
      this.$store.commit("loginOut");
      this.$router.push("/login");
    }
  },
  computed: {
    userName() {
      return this.$store.state.name;
    }
  }
};
</script>

<style>
</style>